package com.stx.entity;

import java.util.Date;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;

@Entity
@Table(name="us_collection")
@SequenceGenerator(name="uc_id",sequenceName="uc_id",initialValue=1,allocationSize=1)
public class User_collection {

	@Id
	@Column(nullable=false)
    @GeneratedValue(generator="uc_id",strategy=GenerationType.SEQUENCE)
	private long  uc_id;
	
	private Date uc_time;
	
	
	@ManyToOne(cascade= {CascadeType.PERSIST,CascadeType.MERGE},fetch=FetchType.EAGER,optional=false)
    @JoinColumn(name="fi_id")
	private Film film;
	
	@ManyToOne(cascade= {CascadeType.PERSIST,CascadeType.MERGE},fetch=FetchType.EAGER,optional=false)
    @JoinColumn(name="us_id")
	private User user;

	
	/*
	 * 
	 * get/set
	 * */
	
	public long getUc_id() {
		return uc_id;
	}

	public void setUc_id(long uc_id) {
		this.uc_id = uc_id;
	}

	public Date getUc_time() {
		return uc_time;
	}

	public void setUc_time(Date uc_time) {
		this.uc_time = uc_time;
	}

	public Film getFilm() {
		return film;
	}

	public void setFilm(Film film) {
		this.film = film;
	}

	public User getUser() {
		return user;
	}

	public void setUser(User user) {
		this.user = user;
	}
	
	
	
}
